package com.ymttest.database.sqlwapper.shenqirisk;

import java.util.HashMap;
import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.shenqirisk.CustomsYearStatistic;

public class CustomsYearStatisticWrapper {
	
	SqlManager manager;

	public CustomsYearStatisticWrapper() {
		manager = new SqlManager("shenqirisk");
	}

	@SuppressWarnings("unchecked")
	public List<CustomsYearStatistic> selectBySellerIdAndPhone(Long sellerId,
			String phone) {

		HashMap<String, Object> map = new HashMap<>();

		map.put("seller_id", sellerId);
		map.put("phone", phone);

		List<CustomsYearStatistic> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.shenqirisk.CustomsYearStatisticMapper.selectBySellerIdAndPhone",
						map);
		manager.commit();

		return result;
	}

	public int updateYearBySellerIdAndPhone(String statisticYear, Long sellerId,
			String phone) {

		HashMap<String, Object> map = new HashMap<>();

		map.put("statistic_year", statisticYear);
		map.put("seller_id", sellerId);
		map.put("phone", phone);

		int result = manager
				.update("com.ymttest.database.mapping.shenqirisk.CustomsYearStatisticMapper.updateYearBySellerIdAndPhone",
						map);
		manager.commit();

		return result;
	}
	
	public static void main(String[] args) {
		
		CustomsYearStatisticWrapper wrapper = new CustomsYearStatisticWrapper();
		
		System.out.println(wrapper
				.updateYearBySellerIdAndPhone("202105", 500041475L, "13671492546"));
	}
}
